//获取地址栏的categoryId参数
var categoryId = getUrlParams('categoryId');

//根据地区id获取推荐列表
$.ajax({
    type: 'get',
    url: '/posts/category/' + categoryId,
    async: false,
    success: function(response) {
        let data = response.filter(item => {
            return item.state == 1;
        });
        var html = template('listTpl', {
            data: data
        });
        $('#listBox').html(html)
    }
})

//根据地区id获取地区信息
$.ajax({
    type: 'get',
    url: '/categories/' + categoryId,
    success: function(response) {
        $('#categoryTitle').html(response.title)
    }
})